package cn.lili.controller.feign.plus;

import cn.lili.modules.member.service.VipActiveCodeService;
import cn.lili.modules.member.service.VipCodeService;
import cn.lili.modules.plus.service.UrbanVipCodeClientService;
import cn.lili.modules.system.client.UrbanVipCodeClient;
import cn.lili.modules.system.entity.dos.LiVipActiveCode;
import cn.lili.modules.system.entity.dos.LiVipApply;
import cn.lili.modules.system.entity.dto.ApplyCodeDto;
import cn.lili.modules.urbansubstation.entity.dto.VipCodeSearchPageParams;
import cn.lili.modules.urbansubstation.entity.dto.VipCodeSearchParams;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequiredArgsConstructor
public class UrbanVipCodeClientController implements UrbanVipCodeClient {
    @Autowired
    private UrbanVipCodeClientService codeService;

    private final VipActiveCodeService vipActiveCodeService;

    @Override
    public Page<LiVipApply> list(ApplyCodeDto dto) {
        return codeService.getList(dto);
    }

    @Override
    public void codeApply(LiVipApply liVipApply) {
        codeService.codeApply(liVipApply);
    }

    @Override
    public Page<LiVipActiveCode> getPageByUrbanId(VipCodeSearchPageParams vipCodeSearchParams) {
        return vipActiveCodeService.getCodePage(vipCodeSearchParams.getVipCodeSearchParams(), vipCodeSearchParams.getPage());
    }
}
